package com.ruoyi.ncpsy.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ncpsy.mapper.NcpsyAgrProductArchiveMapper;
import com.ruoyi.ncpsy.domain.NcpsyAgrProductArchive;
import com.ruoyi.ncpsy.service.INcpsyAgrProductArchiveService;

/**
 * 农产品档案Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-10
 */
@Service
public class NcpsyAgrProductArchiveServiceImpl implements INcpsyAgrProductArchiveService 
{
    @Autowired
    private NcpsyAgrProductArchiveMapper ncpsyAgrProductArchiveMapper;

    @Autowired
    private SysUserMapper sysUserMapper;
    /**
     * 查询农产品档案
     * 
     * @param primaryId 农产品档案主键
     * @return 农产品档案
     */
    @Override
    public NcpsyAgrProductArchive selectNcpsyAgrProductArchiveByPrimaryId(Long primaryId)
    {
        return ncpsyAgrProductArchiveMapper.selectNcpsyAgrProductArchiveByPrimaryId(primaryId);
    }

    /**
     * 查询农产品档案列表
     * 
     * @param ncpsyAgrProductArchive 农产品档案
     * @return 农产品档案
     */
    @Override
    public List<NcpsyAgrProductArchive> selectNcpsyAgrProductArchiveList(NcpsyAgrProductArchive ncpsyAgrProductArchive)
    {
        return ncpsyAgrProductArchiveMapper.selectNcpsyAgrProductArchiveList(ncpsyAgrProductArchive);
    }

    /**
     * 新增农产品档案
     * 
     * @param ncpsyAgrProductArchive 农产品档案
     * @return 结果
     */
    @Override
    public int insertNcpsyAgrProductArchive(NcpsyAgrProductArchive ncpsyAgrProductArchive)
    {
        ncpsyAgrProductArchive.setCreateTime(DateUtils.getNowDate());
        return ncpsyAgrProductArchiveMapper.insertNcpsyAgrProductArchive(ncpsyAgrProductArchive);
    }

    /**
     * 修改农产品档案
     * 
     * @param ncpsyAgrProductArchive 农产品档案
     * @return 结果
     */
    @Override
    public int updateNcpsyAgrProductArchive(NcpsyAgrProductArchive ncpsyAgrProductArchive)
    {
        ncpsyAgrProductArchive.setUpdateTime(DateUtils.getNowDate());
        return ncpsyAgrProductArchiveMapper.updateNcpsyAgrProductArchive(ncpsyAgrProductArchive);
    }

    /**
     * 批量删除农产品档案
     * 
     * @param primaryIds 需要删除的农产品档案主键
     * @return 结果
     */
    @Override
    public int deleteNcpsyAgrProductArchiveByPrimaryIds(Long[] primaryIds)
    {
        return ncpsyAgrProductArchiveMapper.deleteNcpsyAgrProductArchiveByPrimaryIds(primaryIds);
    }

    /**
     * 删除农产品档案信息
     * 
     * @param primaryId 农产品档案主键
     * @return 结果
     */
    @Override
    public int deleteNcpsyAgrProductArchiveByPrimaryId(Long primaryId)
    {
        return ncpsyAgrProductArchiveMapper.deleteNcpsyAgrProductArchiveByPrimaryId(primaryId);
    }

    @Override
    public int selectNcpsyAgrProductArchiveCount() {
        return ncpsyAgrProductArchiveMapper.selectNcpsyAgrProductArchiveCount();
    }

    @Override
    public int selectNcpsyAgrProductArchiveComCount() {
        return sysUserMapper.selectNcpsyAgrProductArchiveComCount();
    }
}
